package com.ruoyi.process.service.impl;

import java.util.List;

import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.process.domain.MaintainRecord;
import com.ruoyi.process.mapper.MaintainRecordMapper;
import com.ruoyi.process.service.IMaintainRecordService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

/**
 * 设备维护记录Service业务层处理
 *
 * @author wng
 * @date 2024-08-04
 */
@Service
public class MaintainRecordServiceImpl implements IMaintainRecordService {
    @Resource
    private MaintainRecordMapper maintainRecordMapper;

    /**
     * 查询设备维护记录
     *
     * @param id 设备维护记录主键
     * @return 设备维护记录
     */
    @Override
    public MaintainRecord selectMaintainRecordById(Long id) {
        return maintainRecordMapper.selectMaintainRecordById(id);
    }

    /**
     * 查询设备维护记录列表
     *
     * @param maintainRecord 设备维护记录
     * @return 设备维护记录
     */
    @Override
    public List<MaintainRecord> selectMaintainRecordList(MaintainRecord maintainRecord) {
        return maintainRecordMapper.selectMaintainRecordList(maintainRecord);
    }

    /**
     * 新增设备维护记录
     *
     * @param maintainRecord 设备维护记录
     * @return 结果
     */
    @Override
    public int insertMaintainRecord(MaintainRecord maintainRecord) {
        maintainRecord.setCreateTime(DateUtils.getNowDate());
        return maintainRecordMapper.insertMaintainRecord(maintainRecord);
    }

    /**
     * 修改设备维护记录
     *
     * @param maintainRecord 设备维护记录
     * @return 结果
     */
    @Override
    public int updateMaintainRecord(MaintainRecord maintainRecord) {
        maintainRecord.setUpdateTime(DateUtils.getNowDate());
        return maintainRecordMapper.updateMaintainRecord(maintainRecord);
    }

    /**
     * 批量删除设备维护记录
     *
     * @param ids 需要删除的设备维护记录主键
     * @return 结果
     */
    @Override
    public int deleteMaintainRecordByIds(Long[] ids) {
        return maintainRecordMapper.deleteMaintainRecordByIds(ids);
    }

    /**
     * 删除设备维护记录信息
     *
     * @param id 设备维护记录主键
     * @return 结果
     */
    @Override
    public int deleteMaintainRecordById(Long id) {
        return maintainRecordMapper.deleteMaintainRecordById(id);
    }
}
